deltas: Fix regression in ostree_repo_static_delta_execute_offline
authorAlexander Larsson <alexl@redhat.com>
Wed, 24 Feb 2016 14:17:46 +0000 (15:17 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 24 Feb 2016 14:54:09 +0000 (15:54 +0100)
xdg-app passed this a filename directly, and in this case it should be
used as is. This regressed to always look for "superblock" in the same
directory as the passed in filename.

https://bugzilla.gnome.org/show_bug.cgi?id=762617

src/libostree/ostree-repo-static-delta-core.c

index eb6de3bb5c57d2d363157dae878925d002d4f422..ea5842f7d877ca4053a6381aaa636981c9d44275 100644 (file)
@@ -240,6 +240,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo                    *self,
   g_autoptr(GVariant) fallback = NULL;
   g_autofree char *to_checksum = NULL;
   g_autofree char *from_checksum = NULL;
+  g_autofree char *basename = NULL;
 
   dir_or_file_path = gs_file_get_path_cached (dir_or_file);
 
@@ -255,13 +256,16 @@ ostree_repo_static_delta_execute_offline (OstreeRepo                    *self,
       else
         {
           g_autofree char *dir = dirname (g_strdup (dir_or_file_path));
+          basename = g_path_get_basename (dir_or_file_path);
 
           if (!glnx_opendirat (AT_FDCWD, dir, TRUE, &dfd, error))
             goto out;
         }
     }
+  else
+    basename = g_strdup ("superblock");
 
-  meta_fd = openat (dfd, "superblock", O_RDONLY | O_CLOEXEC);
+  meta_fd = openat (dfd, basename, O_RDONLY | O_CLOEXEC);
   if (meta_fd < 0)
     {
       glnx_set_error_from_errno (error);